package com.weipeep.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weipeep.sys.query.ConsultantQuery;
import com.weipeep.sys.vo.ConsultantVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.weipeep.sys.dao.ConsultantDao;
import com.weipeep.sys.domain.ConsultantDO;
import com.weipeep.sys.service.ConsultantService;
import com.weipeep.common.base.CoreServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2018-08-05 10:34:17 | wangyun</small>
 */
@Service
public class ConsultantServiceImpl extends CoreServiceImpl<ConsultantDao, ConsultantDO> implements ConsultantService {
    @Resource
    private ConsultantDao consultantDao;
    @Override
    public Page<ConsultantVo> selectConsultantPage(Page<ConsultantVo> page, Wrapper<ConsultantVo> wrapper) {
        ConsultantQuery consultantQuery = new ConsultantQuery();
        consultantQuery.setLimit(page.getSize());
        consultantQuery.setOffset((page.getCurrent()-1)*page.getSize());
        List<ConsultantVo> consultantVoList = consultantDao.selectConsultantList(consultantQuery);
        page.setRecords(consultantVoList);
        return page;
    }

    @Override
    public int selectConsultantCount(Wrapper<ConsultantVo> wrapper) {
        ConsultantQuery consultantQuery = new ConsultantQuery();
        return consultantDao.selectConsultantCount(consultantQuery);
    }
}
